const Mock = require('mockjs')

const data = Mock.mock({
  'items|20': [{
    id: '@id',
    title: '@sentence(1, 5)',
    author: 'name',
    createTime: '@datetime',
    lookNum: '@integer(300, 5000)',
    review: '@integer(300, 5000)',
    likeNum: '@integer(300, 5000)',
    content: '@sentence(50,150)',
    'tags': ['1','2','3']
  }]
})

module.exports = [{
  url: '/article/list/all',
  type: 'get',
  response: config => {
    const items = data.items
    return {
      "code": 2000,
      "msg": "SUCCESS",
      "description": "total:5",
      "data": items
    }
  }
}, {
  url: '/article/select/10',
  type: 'get',
  response: config => {
    const items = data.items
    return {
      "code": 2000,
      "msg": "SUCCESS",
      "description": "total:1",
      "data": items[0]
    }
  }
},{
  url: '/article/insert',
  type: 'post',
  response: config => {
    const items = data.items
    return {
      "code": 2000,
      "msg": "SUCCESS",
      "description": "",
      "data": items[0]
    }
  }
}]
